package com.chengh.vhr.service.serviceImpl;

import com.chengh.vhr.mapper.HrRoleMapper;
import com.chengh.vhr.service.HrRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class HrRoleServiceImpl implements HrRoleService {

    @Autowired
    HrRoleMapper hrRoleMapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean updateHrRole(int hrId, List<Integer> roleIds) {
        hrRoleMapper.deleteHrRoleByHrid(hrId);
        if(roleIds != null && roleIds.size() >= 0 ) {
            hrRoleMapper.insertHrRoleByHrid(hrId,roleIds);
        }

        return true;
    }
}
